package com.webflux.dmeo.functionCompileDemo;

import java.util.ArrayList;

/**
 * Created by wangzhanjin on 2018/5/30.
 */
@FunctionalInterface
interface IntefaceSelf {
    int doubleNum(int i);
    default int add(int x, int y) {
        return x + y;
    }
}

public class LambdaDemo1 {
    public static void main(String[] args) {
        IntefaceSelf i1 = (i) -> i * 2;
        //常见写法，只有一个参数，直接省略掉了
        IntefaceSelf i2 = i -> i * 3;
        //可以定义类型，一行是默认省略了return
        IntefaceSelf i3 = (int i) -> i * 2;
        IntefaceSelf i4 = (int i) -> {
            System.out.println("---------");
            return i * 2;
        };

        System.out.println(i1.doubleNum(10));
        System.out.println(i1.add(10,50));
        System.out.println(i2.doubleNum(10));

        ArrayList<Object> objects = new ArrayList<>();

    }
}
